package com.example.phone.account.activity;

import android.content.Intent;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.example.phone.R;
import com.example.phone.base.BaseActivity;
import com.example.phone.base.MyApp;
import com.example.phone.base.RequestInterface;
import com.example.phone.bean.User;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import de.hdodenhof.circleimageview.CircleImageView;

/**
 * Created by Administrator on 2018\12\26 0026.
 */

public class AccountActivity extends BaseActivity {


    @BindView(R.id.wait_paying)
    LinearLayout waitPaying;
    @BindView(R.id.wait_receving)
    LinearLayout waitReceving;
    @BindView(R.id.all_orders)
    LinearLayout allOrders;
    @BindView(R.id.address_manage)
    TextView addressManage;
    @BindView(R.id.ci_head_portrait)
    CircleImageView ciHeadPortrait;

    /**
     * 是否登录
     */
    private boolean is_login = true;
    private User user;

    @Override
    public void initData() {
        MyApp myApp = (MyApp)getApplication();
        user = myApp.getUser();
        String imagePath = RequestInterface.baseImgPath+user.getHeadPortraitUrl();
        log(imagePath);

        Glide.with(this)
                .load(imagePath)
                .into(ciHeadPortrait);

    }

    @Override
    public void initView() {

    }

    @Override
    public int initLayout() {
        log("设置页面");
        return R.layout.my_accout_layout;
    }

    @OnClick({R.id.wait_paying, R.id.wait_receving, R.id.all_orders, R.id.address_manage, R.id.ci_head_portrait})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.wait_paying:
                break;
            case R.id.wait_receving:
                goNextActivity(WaitPayActivity.class);
                break;
            case R.id.all_orders:

                break;
            case R.id.address_manage:
                if (is_login) {
                    //用户登录   跳转到地址管理界面
                    Intent intent = new Intent(this, ManageActivity.class);

                    startActivity(intent);
                } else {
                    //未登录
                }
                break;

            case R.id.ci_head_portrait:
                log("跳转到个人资料页面");
                Intent intent = new Intent(this, PersonInfomationActivity.class);
                startActivity(intent);
                break;
        }
    }




}
